<template>
<div>
  <div class="loading" :class="{'loading-box-active':$store.state.loading}">
  </div>
  <div class="loading-img" :class="{'loading-img-active':$store.state.loading}"></div>
</div>

</template>

<script>
export default {
  name: 'loading',
  data(){
    return{
    }
  },
  props: {
    msg: String
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">


  @keyframes loading {
    0%{
      height: 0;
    }
    15%{
      height: 140%;
    }
    85%{
      height: 140%;
    }
    100%{
      height: 0;
    }
  }
  @-webkit-keyframes row-opacity {
    0% {
        opacity: 0
    }
     20% {
        opacity: .8
    }
     70% {
        opacity: 1
    }
    
    100% {
        opacity: 0
    }
  }
  .loading{
    // width: 230%;
    height: 12%;
    width: 230%;
    background-color: rgb(104, 152, 241);
    position: absolute;
    left: 45%;
    top: 0%;
    z-index: 991;
    transform: rotate(45deg) ;
    transform-origin:center top 0; // 确认基点
    animation-fill-mode: forwards;
  }
  .loading-box-active{
    animation: loading 4s linear alternate;
  }
  .loading-img-active{
    animation: row-opacity 2s linear alternate;
  }
  .loading-img{
    position: absolute;
    width: 100px;
    height: 107px;
    left:  50%;
    top: 50%;
    z-index: 992;
    opacity: 0;
    transform: translate(-50%,-50%);
    background-image: url(../assets/qq.png);
    background-size: 143%;
    background-position: -10% 66.5%;
    animation-fill-mode: forwards;
    animation-delay: 1s;
  }
  .loading-img::before{
    content: "loading...";
    display: block;
    position: relative;
    bottom: -120%;
    color: white;
    font-size: 22px;
  }
</style>
